package com.example.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

	@RequestMapping("hello")
	
	public String publi() {
		return "<h1>这是我的第一个页面</h1>";
	}
	
//	@RequestMapping(value="arg",method=RequestMethod.POST)
//	@GetMapping("arg")
	@RequestMapping(value="arg/**/abc",params= {"age=26"},headers= {"!Cookie"})
	public String testArg(String name,Integer age) {
		return String.format("<h1>name:%s;age:%d</h1>", name,age);
		
	}
	
	@GetMapping("path/name/{name}/age/{age}")
	public String pathValue(@PathVariable("name") String name
			,@PathVariable("age") Integer age) {
		return String.format("<h1>姓名:%s;年龄:%d</h1>", name,age);
	}
}
